Wpf materialdesign

❗🕜 Warning: this article may contain outdated information. Consider before using any descriptions/solutions, but it may still be helpful.

This is now handled differently and the text below is invalid for versions after 2019-05-07

MDriven uses the MaterialDesign styled controls provided by http://materialdesigninxaml.net/ internally, but you can also use them in MDriven WPF applications.

We have noticed an elusive problem: growing UIs - every second placed control gets a little bit bigger in a never-ending loop. I have been unable to pinpoint the reason but it looks like if the line under the control is databound to the width of the control, they appear to influence each other in a ping-pong way that gives the effect of a never-ending loop.

In my hunt for a solution (that does not require a replacement of the control templates altogether), I have found that setting the MaxWidth of the control stops the behavior (once the MaxWidth is reached). But this is inconsistent with what we want - we want controls to adapt to the display grid - that is unrestricted by a MaxWidth. I also found that the MaxWidth only needs to be in effect during the main setup pass of the ViewModel-driven UI. After this initial pass, the MaxWidth can be removed.

Given these findings, we are offering a workaround: Set the MaxWidth to the special value 3.14 (pi) - and if that value is found as MaxWidth, we will remove it and put auto instead after the initialization.

This page was edited more than 6 months ago on 06/21/2024. What links here